<template>
	<view>
		<button type="primary" @click="setStorage">存储数据</button>
		<button type="primary" @click="getStorage">获取数据</button>
		<button type="primary" @click="removeId">移除id</button>
		
		
		<button @click="pullDown">下拉刷新</button>
		<view>这是列表页</view>
		<view class="box-item" v-for="item in list">{{item}}</view>
		
		
		<!-- #ifdef H5 -->
		<view> 我希望只在h5页面看到</view>
		<!-- #endif -->
		<view> 我希望只在微信小程序页面看到</view>
		<!-- #endif -->
		<!-- #ifdef APP -->
		<view> 我希望只在app页面看到</view>
	</view>
</template>

<script>
	export default{
		data(){
			return{
				list:['前端','java','ui','测试','大数据'],
				imgArr:[]
			}
		},
		methods:{
			setStorage(){
				
			}
			pullDown(){
				console.log('开启下拉刷新')
				uni.starPullDownRefresh()
			},
			chooseImg(){
				uni.chooseImage({
					count:5,
					success:res=>{
						this.imgArr = res.tempFilePaths
					}
				})
			},
			previewImg(current){
				uni.previewImage(){
					current,
					urls:this.imgArr,
					loop:true,
				}
			}
		}
	}
	onPullDownRefresh(){
		console.log('触发了下拉刷新')
		setTimeout(()=>{
			this.list=['前端','java','ui','测试','大数据'],
			uni.stopPullDownRefresh()
		},2000)
	},
	onReachBottom(){
		console.log('页面触底了')
		this.list=[...this.list,...['前端','java','ui','测试','大数据']]
	},
	onload(options){
		console.log('页面加载了',Options)
	},
	onshow(){
		console.log('页面显示了')
	},
	onReady(){
		console.log('页面初次渲染成功了')
	},
	onHide(options){
		console.log('页面隐藏了')
	},
	methods:{
		setStorage(){
			uni.setStorageSync('id',100)
		},
		getStorage(){
			const res = uni.getStorageSync('id')
			console.log(res)
		}
	}
</script>

<style>
	.box-item{
		height: 100px;
		line-height: 100px;
	}
	view{
		color: hotpink;
	}
	view{
		color: #0000ff;
	}
	.box-item{
		height: 100px;
		line-height: 100px;
	}

</style>